package com.yk.spark.model;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by Limit on 2017/8/24.
 */
@Entity
@Table(name = "app", schema = "cykspark", catalog = "")
public class AppModel {
    private String appId;
    private String appName;
    private String appType;
    private String appParameters;
    private Timestamp createTime;
    private Timestamp updateTime;
    private String appInput;
    private String appOutput;
    private String submissionId;

    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid")
    @Id
    @Column(name = "APP_ID")
    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    @Basic
    @Column(name = "APP_NAME")
    public String getAppName() {
        return appName;
    }

    public void setAppName(String appName) {
        this.appName = appName;
    }

    @Basic
    @Column(name = "APP_TYPE")
    public String getAppType() {
        return appType;
    }

    public void setAppType(String appType) {
        this.appType = appType;
    }

    @Basic
    @Column(name = "APP_PARAMETERS",length = 65536 )
    public String getAppParameters() {
        return appParameters;
    }

    public void setAppParameters(String appParameters) {
        this.appParameters = appParameters;
    }

    @Basic
    @Column(name = "CREATE_TIME")
    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    @Basic
    @Column(name = "UPDATE_TIME")
    public Timestamp getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Timestamp updateTime) {
        this.updateTime = updateTime;
    }

    @Basic
    @Column(name = "APP_INPUT",length = 65536 )
    public String getAppInput() {
        return appInput;
    }

    public void setAppInput(String appInput) {
        this.appInput = appInput;
    }

    @Basic
    @Column(name = "APP_OUTPUT")
    public String getAppOutput() {
        return appOutput;
    }

    public void setAppOutput(String appOutput) {
        this.appOutput = appOutput;
    }

    @Basic
    @Column(name = "SUBMISSION_ID")
    public String getSubmissionId() {
        return submissionId;
    }

    public void setSubmissionId(String submissionId) {
        this.submissionId = submissionId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        AppModel model = (AppModel) o;

        if (appId != null ? !appId.equals(model.appId) : model.appId != null) return false;
        if (appName != null ? !appName.equals(model.appName) : model.appName != null) return false;
        if (appType != null ? !appType.equals(model.appType) : model.appType != null) return false;
        if (appParameters != null ? !appParameters.equals(model.appParameters) : model.appParameters != null)
            return false;
        if (createTime != null ? !createTime.equals(model.createTime) : model.createTime != null) return false;
        if (updateTime != null ? !updateTime.equals(model.updateTime) : model.updateTime != null) return false;
        if (appInput != null ? !appInput.equals(model.appInput) : model.appInput != null) return false;
        if (appOutput != null ? !appOutput.equals(model.appOutput) : model.appOutput != null) return false;
        if (submissionId != null ? !submissionId.equals(model.submissionId) : model.submissionId != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = appId != null ? appId.hashCode() : 0;
        result = 31 * result + (appName != null ? appName.hashCode() : 0);
        result = 31 * result + (appType != null ? appType.hashCode() : 0);
        result = 31 * result + (appParameters != null ? appParameters.hashCode() : 0);
        result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
        result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0);
        result = 31 * result + (appInput != null ? appInput.hashCode() : 0);
        result = 31 * result + (appOutput != null ? appOutput.hashCode() : 0);
        result = 31 * result + (submissionId != null ? submissionId.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "AppModel{" +
                "appId='" + appId + '\'' +
                ", appName='" + appName + '\'' +
                ", appType='" + appType + '\'' +
                ", appParameters='" + appParameters + '\'' +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", appInput='" + appInput + '\'' +
                ", appOutput='" + appOutput + '\'' +
                ", submissionId='" + submissionId + '\'' +
                '}';
    }
}
